package org.springblade.oa.wrappper;

import org.springblade.core.mp.support.BaseEntityWrapper;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.SpringUtil;
import org.springblade.oa.entity.Bxxcmx;
import org.springblade.oa.entity.Bxzszpmx;
import org.springblade.oa.service.IBxxcmxService;
import org.springblade.oa.service.IBxzszpmxService;
import org.springblade.oa.service.IExpenseAccountService;
import org.springblade.oa.vo.BxxcmxVO;
import org.springblade.oa.vo.BxzszpmxVO;
import org.springblade.system.feign.IDictClient;

/**
 * @author LK
 * @version 1.0.0
 * @Title: BxzszpmxWrapper.java
 * @Description: TODO    返回视图报销住宿专票明细
 * @date 2020/1/16 15:17
 */
public class BxzszpmxWrapper extends BaseEntityWrapper<Bxzszpmx, BxzszpmxVO> {

	private static IBxzszpmxService bxzszpmxService;

	private static IDictClient dictClient;

	private static IExpenseAccountService expenseAccountService;

	private static IBxxcmxService bxxcmxService;

	static {
		bxzszpmxService = SpringUtil.getBean(IBxzszpmxService.class);
		dictClient = SpringUtil.getBean(IDictClient.class);
		expenseAccountService = SpringUtil.getBean(IExpenseAccountService.class);
		bxxcmxService=SpringUtil.getBean(IBxxcmxService.class);
	}

	public static BxzszpmxWrapper build() {
		return new BxzszpmxWrapper();
	}

	@Override
	public BxzszpmxVO entityVO(Bxzszpmx bxzszpmx) {
		BxzszpmxVO bxzszpmxVO = BeanUtil.copy(bxzszpmx, BxzszpmxVO.class);
		//设置项目名称
		bxzszpmxVO.setXmbhName(expenseAccountService.getProjectName(bxzszpmx.getXmbh()));
		bxzszpmxVO.setXmbhAbbName(expenseAccountService.getProjectAbbName(bxzszpmx.getXmbh()));
		return bxzszpmxVO;
	}
}
